import sys
import os
from MainFrm import Ui_mainForm
from PyQt5 import QtCore, QtGui, QtWidgets
from core import WC


class ExtendWindow(QtWidgets.QMainWindow):
    def closeEvent(self, event):
        os.system('regsvr32 lib/wc.dll /s /u')
        print('动态库卸载成功')





class mainFrm(ExtendWindow):
    def __init__(self):
        ExtendWindow.__init__(self)
        self.ui = Ui_mainForm()
        self.ui.setupUi(self)
        self.ui.btnColor.clicked.connect(self.getColor)
        # 给button 的 点击动作绑定一个事件处理函数
    def getColor(self):
        x = self.ui.ptx.text()
        y = self.ui.pty.text()
        color = self.dm.dm.GetColor(x,y)
        self.ui.colorText.setText(color)

if __name__ == '__main__':
    app = QtWidgets.QApplication(sys.argv)
    window = mainFrm()
    window.show()
    window.dm = WC()
    window.ui.txtStatus.setText("loaded")
    window.setEnabled(True)
    sys.exit(app.exec_())
